package com.erps.dao;

import com.erps.CommonUtils.ActiveField;
import com.erps.CommonUtils.DateUtils;
import com.erps.CommonUtils.JActiveField;
import com.erps.CommonUtils.JActiveTable;
import com.erps.CommonUtils.Sequence;
import com.erps.db.DBManager;
import com.hmkj.entity.ErspResPicture;
import com.hmkj.entity.ErspSysFunction;

public class ErspSysFunctionDao extends JActiveTable {
	public ErspSysFunctionDao() {
		this.setDBTableName("ersp_res_function");
		AddField(new JActiveField("id", "id", ActiveField.ftString, 36));
		setDefaultFieldValue("id", Sequence.getGuid());
		AddField(new JActiveField("func_name", "func_name", ActiveField.ftString, 20));
		AddField(new JActiveField("func_key", "func_key", ActiveField.ftString, 20));
		AddField(new JActiveField("func_desc", "func_desc", ActiveField.ftString, 200));
		
		
		AddField(new JActiveField("last_update_time", "last_update_time", ActiveField.ftLong));
		setDefaultFieldValue("last_update_time", String.valueOf(DateUtils.getDayTimeNum()));
        setDbKeyFields("id");
	}

	public int add(ErspSysFunction vo) {
		setFieldValue("id", vo.getId());
		setFieldValue("func_name", vo.getFunc_name());
		setFieldValue("func_key", vo.getFunc_key());
		setFieldValue("func_desc", vo.getFunc_desc());
		return DBManager.ExecSQL(this.getSQL());
	}

	public String getSQL(ErspSysFunction vo) {
		setFieldValue("id", vo.getId());
		setFieldValue("func_name", vo.getFunc_name());
		setFieldValue("func_key", vo.getFunc_key());
		setFieldValue("func_desc", vo.getFunc_desc());
		return this.getSQL();
	}
}
